Skip to content

compiletest: Use the new non-libtest executor by default #139998

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Zalathar
Copy link
Contributor

The new executor was implemented in #139660, but required a manual opt-in. This PR activates the new executor by default, but leaves the old libtest-based executor in place (temporarily) to make reverting easier if something unexpectedly goes horribly wrong.

Currently the new executor can be explicitly disabled by passing the -N flag to compiletest (e.g. ./x test ui -- -N), but eventually that flag will be removed, alongside the removal of the libtest dependency. The flag is mostly there to make manual comparative testing easier if something does go wrong.

As before, there should be no user-visible difference between the old executor and the new executor.


I didn't get much of a response to my call for testing thread on Zulip, and the reports I did get (along with my own usage) indicate that there aren't any problems. So I think it's reasonable to move forward with making this the default, in the hopes of being able to remove the libtest dependency relatively soon.

When the libtest dependency is removed, it should be reasonable to build compiletest against pre-built stage0 std by default, even after the stage0 redesign. (Though we should probably have at least one CI job using in-tree stage1 std instead, to guard against the possibility of the #![feature(internal_output_capture)] API actually changing.)

Currently the new executor can be explicitly disabled by passing the `-N` flag
to compiletest (e.g. `./x test ui -- -N`), but eventually that flag will be
removed, alongside the removal of the libtest dependency.
@Zalathar Zalathar added the A-compiletest Area: The compiletest test runner label Apr 18, 2025
@rustbot
Copy link
Collaborator

rustbot commented Apr 18, 2025

r? @onur-ozkan

rustbot has assigned @onur-ozkan.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Apr 18, 2025
@rustbot
Copy link
Collaborator

rustbot commented Apr 18, 2025

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@onur-ozkan
Copy link
Member

Makes sense, thanks!

@bors r+ rollup

@bors
Copy link
Collaborator

bors commented Apr 18, 2025

📌 Commit 03373ee has been approved by onur-ozkan

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 18, 2025
@Kobzol
Copy link
Contributor

Kobzol commented Apr 18, 2025

Just in case, have you benchmarked the time to execute the UI suite between the two executors?

@Zalathar
Copy link
Contributor Author

With libtest:

$ x test ui -- --force-rerun -N

test result: ok. 18603 passed; 0 failed; 322 ignored; 0 measured; 0 filtered out; finished in 187.32s
test result: ok. 18603 passed; 0 failed; 322 ignored; 0 measured; 0 filtered out; finished in 193.96s
test result: ok. 18603 passed; 0 failed; 322 ignored; 0 measured; 0 filtered out; finished in 189.54s

With the new executor:

$ x test ui -- --force-rerun

test result: ok. 18603 passed; 0 failed; 322 ignored; 0 measured; 0 filtered out; finished in 195.85s
test result: ok. 18603 passed; 0 failed; 322 ignored; 0 measured; 0 filtered out; finished in 195.76s
test result: ok. 18603 passed; 0 failed; 322 ignored; 0 measured; 0 filtered out; finished in 195.69s

Based on a few local runs, the new executor seems to consistently be a couple of seconds slower across a 3 minute ui test run, which is a little surprising to me since it should be doing marginally less work overall.

@Kobzol
Copy link
Contributor

Kobzol commented Apr 18, 2025

It's interesting that the new executor seems to be more stable. 5% slower isn't that terrible, but it would be nice to investigate more why it seems to be slower.

@Zalathar
Copy link
Contributor Author

Bug found in deadline detection (#139660 (comment)); I'll push a fix.

@bors r-

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Apr 18, 2025
@jieyouxu
Copy link
Member

Let me also do a few smoke runs of the new executor on msvc in case anything funny occurs.

@jieyouxu
Copy link
Member

I'd also mark this as rollup-never since we're changing the tests/ test harness itself.
@bors rollup=never

@jieyouxu
Copy link
Member

jieyouxu commented Apr 18, 2025

Maybe there's another issue with the deadline logic (with the now <= condition fixed): given a test

// tests/ui/foo.rs

//@ run-pass

fn main() {
    std::thread::sleep(std::time::Duration::from_secs(70)); // 70 to hit the libtest default slow test warning threshold of 60s
}

Due to the way how the libtest-esque test filtering logic works, ./x test foo will run 4 tests.

  • With the libtest executor, I observe only 1 warning correspond to this synthetic slow test

    running 4 tests
    i..test [ui] tests/ui/foo.rs has been running for a long time
    .
    
  • With the new executor, I observe warnings for all the tests

    running 4 tests
    i..test [ui] tests/ui/cfg/cfg-macros-foo.rs has been running for a long time
    test [ui] tests/ui/cfg/cfg-macros-notfoo.rs has been running for a long time
    test [ui] tests/ui/foo.rs has been running for a long time
    test [ui] tests/ui/missing_non_modrs_mod/foo.rs has been running for a long time
    

@Zalathar
Copy link
Contributor Author

Yeah, I'm seeing the same thing.

I think it's because we don't actually remove completed tests from the deadline queue when they finish, so tests are treated as having timed out long after they have already finished. This was being masked by the other bug, which made us not emit any timeout events due to the backwards check.

@jieyouxu
Copy link
Member

I wonder if we can come up with some kind of self-tests for this 🤔

@Zalathar
Copy link
Contributor Author

Well the good news is that fixing the deadline bugs also seems to eliminate the perf difference. 😅

@Zalathar
Copy link
Contributor Author

I think what I want to do here is open a separate PR to fix the deadline bugs (hopefully with some unit tests), and then we can revisit this PR once that has landed.

@jieyouxu
Copy link
Member

Sounds good

@Zalathar
Copy link
Contributor Author

Separate PR to fix deadline bugs: #140031.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants